package com.huabo.system.service.impl;

import com.huabo.system.mysql.entity.TblControlmatrixMySql;
import com.huabo.system.mysql.mapper.TblControlmatrixMySqlMapper;
import com.huabo.system.oracle.entity.TblControlmatrix;
import com.huabo.system.oracle.mapper.TblControlmatrixMapper;
import com.huabo.system.service.TblControlmatrixService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TblControlmatrixServiceImpl implements TblControlmatrixService {

    @Resource
    private TblControlmatrixMapper tblControlmatrixMapper;

    @Resource
    private TblControlmatrixMySqlMapper tblControlmatrixMySqlMapper;

    @Override
    public TblControlmatrix getControlmatrix(String tcmId) {
        List<TblControlmatrix> list = this.tblControlmatrixMapper.findBysql(tcmId);
        return list != null && list.size() > 0 ? (TblControlmatrix) list.get(0) : null;
    }

    @Override
    public TblControlmatrixMySql getMySqlControlmatrix(String tcmId) {
        List<TblControlmatrixMySql> list = this.tblControlmatrixMySqlMapper.findBysql(tcmId);
        return list != null && list.size() > 0 ? (TblControlmatrixMySql) list.get(0) : null;
    }

    @Override
    public void modify(TblControlmatrix tblControlmatrix) {
        tblControlmatrixMapper.insert(tblControlmatrix);
    }

    @Override
    public void modifyMySql(TblControlmatrixMySql tblControlmatrixMySql) {
        tblControlmatrixMySqlMapper.insert(tblControlmatrixMySql);
    }

    @Override
    public void updateMatrix(TblControlmatrix com) {
        tblControlmatrixMapper.updateByPrimaryKeySelective(com);
    }

    @Override
    public void updateMySqlMatrix(TblControlmatrixMySql comMySql) {
        tblControlmatrixMySqlMapper.updateByPrimaryKeySelective(comMySql);
    }


}
